
require("./requires");
var db = require('../utils/db');
var http_service = require("./http_service");
var socket_service = require("./socket_service");
var tableMgr = require("./tablemgr");

//从配置文件获取服务器信息
var configs = require(process.argv[2]);
var config = configs.game_server();

//初始化数据库连接
db.init(configs.mysql());

//初始化redis
var redis = require('../utils/redis');
redis.init(configs.redis());

//开启HTTP服务
http_service.start(config);

//开启外网SOCKET服务
socket_service.start(config);

//初始桌子管理
tableMgr.init();

process.on('uncaughtException', function (err) {
　　console.log('Caught exception: ' + err);
});